package zhr;


public class ex3_4 {
    public static void main(String[] args) {
        System.out.println("** 正确用法 **");
        char grade='C';
        switch (grade){
            case 'A':
                System.out.println(grade + " is 85 ~ 100");
                break;
            case 'B':
                System.out.println(grade + " is 70 ~ 84");
                break;
            case 'C':
                System.out.println(grade + " is 60 ~ 69");
                break;
            case 'D':
                System.out.println(grade + " is < 60");
                break;
            default:
                System.out.println("输入错误");
        }
        System.out.println("** 不含break 的 case语句 **");
        grade ='A';
        switch (grade){
            case 'A':
                System.out.println(grade + " is 85 ~ 100");
            case 'B':
                System.out.println(grade + " is 70 ~ 84");
            case 'C':
                System.out.println(grade + " is 60 ~ 69");
            case 'D':
                System.out.println(grade + " is < 60");
            default:
                System.out.println("输入错误");
        }
        System.out.println("** 部分含 break 的 case 语句 **");
        grade = 'B';
        switch (grade){
            case 'A':
            case 'B':
            case 'C':
                System.out.println(grade + " is >= 60");
                break;
            case 'D':
                    System.out.println(grade + " is < 60");
            default:
                System.out.println("输入错误");
        }
    }
}
